﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class OrgnizeController : MonoBehaviour {

	public GameObject leftCell;

	public GameObject rightCell;

	public GameObject topCell;

	public GameObject downCell;

	public void cellUpdate() {
		int count = this.transform.childCount;
		for (int i = 0; i < count; i++) {
			GameObject cell = this.transform.GetChild (i).gameObject;
			if (leftCell == null || cell.transform.position.x < leftCell.transform.position.x) {
				leftCell = cell;
			}
			if (rightCell == null || cell.transform.position.x > rightCell.transform.position.x) {
				rightCell = cell;
			}
			if (downCell == null || cell.transform.position.y < downCell.transform.position.y) {
				downCell = cell;
			}
			if (topCell == null || cell.transform.position.y > topCell.transform.position.y) {
				topCell = cell;
			}
		}
	}

	public void Update() {
		cellUpdate ();
	}
}
